.class public Les/vj;
.super Les/mj;
.source "VideoThumbnailProvider.java"


# instance fields
.field private c:Lcom/estrongs/fs/f;


# direct methods
.method static constructor <clinit>()V
    .locals 0

    return-void
.end method

.method public constructor <init>(Landroid/content/Context;)V
    .locals 0

    .line 1
    invoke-direct {p0, p1}, Les/mj;-><init>(Landroid/content/Context;)V

    .line 2
    invoke-static {p1}, Lcom/estrongs/fs/f;->a(Landroid/content/Context;)Lcom/estrongs/fs/f;

    move-result-object p1

    iput-object p1, p0, Les/vj;->c:Lcom/estrongs/fs/f;

    return-void
.end method

.method private static a(Landroid/graphics/BitmapFactory$Options;I)I
    .locals 3

    .line 9
    iget v0, p0, Landroid/graphics/BitmapFactory$Options;->outWidth:I

    .line 10
    iget p0, p0, Landroid/graphics/BitmapFactory$Options;->outHeight:I

    .line 11
    div-int v1, v0, p1

    .line 12
    div-int v2, p0, p1

    .line 13
    invoke-static {v1, v2}, Ljava/lang/Math;->max(II)I

    move-result v1

    const/4 v2, 0x1

    if-gt v1, v2, :cond_0

    return v2

    :cond_0
    if-le v1, v2, :cond_1

    if-le v0, p1, :cond_1

    .line 14
    div-int/2addr v0, v1

    if-ge v0, p1, :cond_1

    add-int/lit8 v1, v1, -0x1

    :cond_1
    if-le v1, v2, :cond_2

    if-le p0, p1, :cond_2

    .line 15
    div-int/2addr p0, v1

    if-ge p0, p1, :cond_2

    add-int/lit8 v1, v1, -0x1

    :cond_2
    if-gt v1, v2, :cond_3

    return v2

    :cond_3
    return v1
.end method

.method private a(Ljava/io/InputStream;Landroid/graphics/BitmapFactory$Options;I)Landroid/graphics/Bitmap;
    .locals 1
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Lcom/estrongs/fs/FileSystemException;
        }
    .end annotation

    .line 1
    invoke-static {p2, p3}, Les/vj;->a(Landroid/graphics/BitmapFactory$Options;I)I

    move-result p3

    iput p3, p2, Landroid/graphics/BitmapFactory$Options;->inSampleSize:I

    const/4 p3, 0x1

    .line 2
    iput-boolean p3, p2, Landroid/graphics/BitmapFactory$Options;->inInputShareable:Z

    .line 3
    sget-boolean v0, Lcom/estrongs/android/pop/j;->w:Z

    xor-int/2addr p3, v0

    iput-boolean p3, p2, Landroid/graphics/BitmapFactory$Options;->inPurgeable:Z

    const/4 p3, 0x0

    .line 4
    iput-boolean p3, p2, Landroid/graphics/BitmapFactory$Options;->inJustDecodeBounds:Z

    .line 5
    iput-boolean p3, p2, Landroid/graphics/BitmapFactory$Options;->inDither:Z

    const/16 p3, 0x4000

    new-array p3, p3, [B

    .line 6
    iput-object p3, p2, Landroid/graphics/BitmapFactory$Options;->inTempStorage:[B

    .line 7
    sget-object p3, Landroid/graphics/Bitmap$Config;->RGB_565:Landroid/graphics/Bitmap$Config;

    iput-object p3, p2, Landroid/graphics/BitmapFactory$Options;->inPreferredConfig:Landroid/graphics/Bitmap$Config;

    const/4 p3, 0x0

    .line 8
    invoke-static {p1, p3, p2}, Landroid/graphics/BitmapFactory;->decodeStream(Ljava/io/InputStream;Landroid/graphics/Rect;Landroid/graphics/BitmapFactory$Options;)Landroid/graphics/Bitmap;

    move-result-object p1

    return-object p1
.end method


# virtual methods
.method public a()[Ljava/lang/String;
    .locals 1

    .line 16
    invoke-static {}, Lcom/estrongs/android/util/n0;->k()[Ljava/lang/String;

    move-result-object v0

    return-object v0
.end method

.method protected b()Ljava/lang/String;
    .locals 3

    .line 1
    invoke-virtual {p0}, Les/mj;->c()Ljava/io/File;

    move-result-object v0

    const-string v1, ".thumbnails"

    const/4 v2, 0x1

    invoke-static {v0, v1, v2}, Lcom/estrongs/android/util/h0;->a(Ljava/io/File;Ljava/lang/String;Z)Ljava/lang/String;

    move-result-object v0

    if-nez v0, :cond_0

    .line 2
    iget-object v0, p0, Les/mj;->a:Landroid/content/Context;

    invoke-virtual {v0}, Landroid/content/Context;->getCacheDir()Ljava/io/File;

    move-result-object v0

    const/4 v2, 0x0

    invoke-static {v0, v1, v2}, Lcom/estrongs/android/util/h0;->a(Ljava/io/File;Ljava/lang/String;Z)Ljava/lang/String;

    move-result-object v0

    :cond_0
    return-object v0
.end method

.method protected c(Lcom/estrongs/fs/g;)Landroid/graphics/Bitmap;
    .locals 5
    .annotation build Landroid/annotation/TargetApi;
        value = 0x8
    .end annotation

    .line 1
    invoke-interface {p1}, Lcom/estrongs/fs/g;->d()Ljava/lang/String;

    move-result-object v0

    const/4 v1, 0x0

    .line 2
    :try_start_0
    iget-object v2, p0, Les/vj;->c:Lcom/estrongs/fs/f;

    invoke-virtual {v2, v0}, Lcom/estrongs/fs/f;->k(Ljava/lang/String;)Ljava/io/InputStream;

    move-result-object v2
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    const/4 v3, 0x1

    if-eqz v2, :cond_3

    .line 3
    :try_start_1
    new-instance v4, Landroid/graphics/BitmapFactory$Options;

    invoke-direct {v4}, Landroid/graphics/BitmapFactory$Options;-><init>()V

    .line 4
    iput-boolean v3, v4, Landroid/graphics/BitmapFactory$Options;->inJustDecodeBounds:Z

    .line 5
    invoke-virtual {v2}, Ljava/io/InputStream;->markSupported()Z

    move-result v3

    if-nez v3, :cond_0

    .line 6
    new-instance v3, Ljava/io/BufferedInputStream;

    invoke-direct {v3, v2}, Ljava/io/BufferedInputStream;-><init>(Ljava/io/InputStream;)V

    move-object v2, v3

    :cond_0
    const/high16 v3, 0x200000

    .line 7
    invoke-virtual {v2, v3}, Ljava/io/InputStream;->mark(I)V

    .line 8
    invoke-static {v2, v1, v4}, Landroid/graphics/BitmapFactory;->decodeStream(Ljava/io/InputStream;Landroid/graphics/Rect;Landroid/graphics/BitmapFactory$Options;)Landroid/graphics/Bitmap;
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_1

    .line 9
    :try_start_2
    invoke-virtual {v2}, Ljava/io/InputStream;->reset()V
    :try_end_2
    .catch Ljava/io/IOException; {:try_start_2 .. :try_end_2} :catch_0
    .catchall {:try_start_2 .. :try_end_2} :catchall_1

    goto :goto_0

    .line 10
    :catch_0
    :try_start_3
    invoke-static {v2}, Lcom/estrongs/fs/util/f;->a(Ljava/io/Closeable;)V

    .line 11
    iget-object v3, p0, Les/vj;->c:Lcom/estrongs/fs/f;

    invoke-virtual {v3, v0}, Lcom/estrongs/fs/f;->k(Ljava/lang/String;)Ljava/io/InputStream;

    move-result-object v2

    if-nez v2, :cond_1

    .line 12
    iget-object v3, p0, Les/vj;->c:Lcom/estrongs/fs/f;

    invoke-virtual {v3, v0}, Lcom/estrongs/fs/f;->e(Ljava/lang/String;)Ljava/io/InputStream;

    move-result-object v0

    move-object v2, v0

    .line 13
    :cond_1
    :goto_0
    invoke-static {p1}, Les/rj;->g(Lcom/estrongs/fs/g;)I

    move-result p1

    invoke-direct {p0, v2, v4, p1}, Les/vj;->a(Ljava/io/InputStream;Landroid/graphics/BitmapFactory$Options;I)Landroid/graphics/Bitmap;

    move-result-object p1

    if-nez p1, :cond_2

    .line 14
    iget-object p1, p0, Les/mj;->a:Landroid/content/Context;

    invoke-virtual {p1}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;

    move-result-object p1

    const v0, 0x7f0803d6

    invoke-static {p1, v0}, Landroid/graphics/BitmapFactory;->decodeResource(Landroid/content/res/Resources;I)Landroid/graphics/Bitmap;

    move-result-object p1

    :cond_2
    move-object v1, p1

    goto :goto_1

    .line 15
    :cond_3
    sget p1, Landroid/os/Build$VERSION;->SDK_INT:I

    const/16 v4, 0x8

    if-lt p1, v4, :cond_4

    .line 16
    invoke-static {v0, v3}, Landroid/media/ThumbnailUtils;->createVideoThumbnail(Ljava/lang/String;I)Landroid/graphics/Bitmap;

    move-result-object p1

    const/4 v0, 0x2

    const/16 v3, 0x180

    .line 17
    invoke-static {p1, v3, v3, v0}, Landroid/media/ThumbnailUtils;->extractThumbnail(Landroid/graphics/Bitmap;III)Landroid/graphics/Bitmap;

    move-result-object v1
    :try_end_3
    .catchall {:try_start_3 .. :try_end_3} :catchall_1

    .line 18
    :cond_4
    :goto_1
    invoke-static {v2}, Lcom/estrongs/fs/util/f;->a(Ljava/io/Closeable;)V

    return-object v1

    :catchall_0
    move-object v2, v1

    :catchall_1
    invoke-static {v2}, Lcom/estrongs/fs/util/f;->a(Ljava/io/Closeable;)V

    return-object v1
.end method

.method protected e(Lcom/estrongs/fs/g;)Landroid/graphics/Bitmap$CompressFormat;
    .locals 0

    .line 1
    sget-object p1, Landroid/graphics/Bitmap$CompressFormat;->JPEG:Landroid/graphics/Bitmap$CompressFormat;

    return-object p1
.end method
